package 状态机.请假demo.machine;


import 状态机.请假demo.leavepermit.LeavePermitType;
import 状态机.请假demo.machine.impl.AnnualLeaveStatusMachine;

/**
 * 通过状态机工厂返回某种类型假单的状态机
 *
 */
public class StatusMachineFactory {

    private StatusMachineFactory() {

    }

    /**
     * 根据状态获取状态机
     *
     * @param leavePermitType
     * @return 对应请假类型的状态机
     */
    public static IStatusMachine getStatusMachine(LeavePermitType leavePermitType) {
        switch (leavePermitType) {
            case ANNUAL_LEAVE:
                return new AnnualLeaveStatusMachine();
            default:
                throw new RuntimeException("未知类型");
        }
    }

}
